<template>
    <el-container class="itv-admin-root">
        <layout-menu  />
        <el-container direction="vertical">
            <layout-header  v-if="menus.length" />
            <el-main>
                <router-view v-slot="{ Component }" >
                    <keep-alive>
                            <component :is="Component" />
                    </keep-alive>
                </router-view>
            </el-main>
        </el-container>
    </el-container>
   
</template>
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import { getMenuTree } from '@/api/power.api';
import LayoutMenu from '@/components/layout/menu/menu.tsx';
import layoutHeader from '@/components/layout/header/layout-header.vue'
import { useMenu } from '@/store';
const { updateMenu, menus } = useMenu();
const show = ref(false);
// 初始化
async function init () {
    const res = await getMenuTree({});
    updateMenu(res.data);
}

onMounted(() => {
    init();
})
</script>